import bus from "@/bus";
let data = {
  status: 'pass',
  totalItem: 1,
  pageSize: window.$pageSize,
  currentPage: 1,
  form: {
    keyword: '',
    status: null
  },
  options: [{
    label: '全部',
    value: 0
  }, {
    label: '审核通过',
    value: 1
  }, {
    label: '驳回',
    value: 2
  }, {
    label: '待审核',
    value: 3
  }],
  columns: [{
    title: '商品编码',
    key: 'code',
    align: 'left',
    minWidth: 200
  }, {
    title: '商品名称',
    key: 'title',
    minWidth: 250,
    tooltip: true
  }, {
    title: '商品类目',
    key: 'categoryName',
    align: 'left',
    minWidth: 150
  }, {
    title: '单位',
    key: 'unit',
    align: 'left',
    minWidth: 80
  }, {
    title: '重量KG',
    key: 'weight',
    align: 'right',
    minWidth: 100
  }, {
    title: '基础批发价',
    key: 'salePrice',
    align: 'right',
    minWidth: 150,
    render: (h, params) => {
      return h('div', {
        class: 'font-red',
      },'￥' + params.row.salePrice);
    }
  }, {
    title: '建议零售价',
    key: 'marketPrice',
    align: 'right',
    minWidth: 150,
    render: (h, params) => {
      return h('div', {
        class: 'font-red',
      },'￥' + params.row.marketPrice);
    }
  }, {
    title: '开票价',
    key: 'invoicePrice',
    align: 'right',
    minWidth: 100,
    render: (h, params) => {
      if (params.row.invoicePrice || params.row.invoicePrice == 0) {
        return h('div', {
          class: 'font-red'
        }, '￥' + params.row.invoicePrice)
      }
    }
  }, {
    title: '审核状态',
    key: 'status',
    align: 'left',
    minWidth: 100,
    render: (h, params) => {
      let list = {
        1: '审核通过',
        2: '驳回',
        3: '待审核'
      }
      if (params.row.status === 2) {
        return h('div', [
          h('div', list[params.row.status]),
          h('div', {
            class: 'font-blue'
          }, '(' + params.row.auditFailMsg + ')')
        ])
      } else {
        return h('div', list[params.row.status])
      }
    }
  },{
    title: '操作',
    align: 'right',
    minWidth: 200,
    render: (h, params) => {
      let lookBtn = h('Button', {
        props: {
          size: 'small'
        },
        class: 'mr',
        on: {
          click: () => {
            bus.$emit('onLook', {id: params.row.id})
          }
        }
      }, '查看')
      let editBtn = h('Button', {
        props: {
          size: 'small',
          type: 'primary',
          disabled: params.row.status !== 2 && params.row.status !== 3
        },
        class: 'mr',
        on: {
          click: () => {
            bus.$emit('onEdit', {id: params.row.id, productAuditDTO: params.row.productAuditDTO})
          }
        }
      }, '编辑')
      let delBtn = h('Button', {
        props: {
          size: 'small',
          disabled: params.row.status !== 2 && params.row.status !== 3
        },
        on: {
          click: () => {
            bus.$emit('onDel', {productInfoDTOId: params.row.productInfoDTOId, index: params.index})
          }
        }
      }, '删除')
      let btnBox = [lookBtn, editBtn, delBtn]
      return h('div', btnBox)
    }
  }],
  data: []
}
export default data;